import { ElMessage } from 'element-plus';
let messageDom: any = null;
const ResetMessage: any = options => {
    if (messageDom) messageDom.close();
    messageDom = ElMessage(options);
};
const typeArr = ['success', 'error', 'warning', 'info'];
typeArr.forEach(type => {
    ResetMessage[type] = options => {
        if (typeof options === 'string') options = { message: options };
        options.type = type;
        return ResetMessage(options);
    };
});

export default ResetMessage;
